package com.ruoyi.door.controller.admin.dept;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.door.controller.admin.dept.vo.DoorDeptPriceCreateReqVO;
import com.ruoyi.door.service.DoorDeptPriceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.door.domain.DoorDeptPrice;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 镇街价格Controller
 * 
 * @author ruoyi
 * @date 2025-06-27
 */
@RestController
@RequestMapping("/admin-api/door/dept/price")
@Api(value = "ADMIN 档位-规则", tags = "ADMIN 档位-规则")

public class DoorDeptPriceController extends BaseController
{
    @Autowired
    private DoorDeptPriceService doorDeptPriceService;


    /**
     * 获取镇街价格详细信息
     */
    @ApiOperation("获取镇街价格详细信息")
    @GetMapping(value = "/{deptId}")
    @Anonymous
    public AjaxResult getInfo(@PathVariable("deptId") Long deptId)
    {
        return success(doorDeptPriceService.selectDoorDeptPriceById(deptId));
    }

    /**
     * 新增镇街价格
     */
    @ApiOperation("新增镇街价格")
    @Log(title = "镇街价格", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DoorDeptPriceCreateReqVO doorDeptPrice)
    {
        return toAjax(doorDeptPriceService.insertDoorDeptPrice(doorDeptPrice)>0);
    }
    @ApiOperation("删除镇街价格")
    @Log(title = "镇街价格", businessType = BusinessType.INSERT)
    @GetMapping("/delete")
    public AjaxResult delete(Long deptId)
    {
        doorDeptPriceService.delete(deptId);
        return success();
    }


}
